<td><%= index + 1 %>.</td>
<td><%= order_item.furniture_code %></td>
<td><%= order_item.furniture_name %></td>
<td><%= order_item.furniture_spec %></td>
<td><%= order_item.furniture_color %></td>
<td>
  <div title="客户订购数">
    <b class="status_i has_been_ordered_i">已预订</b>：<span><%= order_item.ordered_count %></span>
  </div>
  <% if order_item.has_been_sent_to_installer_count > 0 %>
  <div title="派工待安装数">
    <b class="status_i installing_i">派工中</b>：<span><%= order_item.has_been_sent_to_installer_count %></span>
  </div>
  <% end %>
  <% if order_item.installed_count > 0 %>
  <div title="已安装完成数">
    <b class="status_i has_been_installed_i">已完成</b>：<span><%= order_item.installed_count %></span>
  </div>
  <% end %>
  <% if order_item.being_order_made_count > 0 %>
  <div title="厂家订做中的数量">
    <b class="status_i has_been_sent_to_factory_i">订做中</b>：<span><%= order_item.being_order_made_count %></span>
  </div>
  <% end %>
  <% if order_item.entered_count > 0 %>
  <div title="厂家订做到货入库数">
    <b class="status_i has_been_entered_i">已入库</b>：<span><%= order_item.entered_count %></span>
  </div>
  <% end %>
</td>
<td >
  <div title="售后服务成本">
    <b class="status_i after_serviced_i">售后</b>：<span>￥<%= number_with_precision(order_item.after_serviced_cost, :precision => 2)%></span>
  </div>
  <div title="已向工厂支付的订做款">
    <b class="status_i has_been_payment_i">订做</b>：<span>￥<%= number_with_precision(order_item.how_much, :precision => 2)%></span>
  </div>
  <div title="已收尾款">
    <b class="status_i has_recieved_i">已收</b>：<span>￥<%= number_with_precision(order_item.gathered_balance, :precision => 2)%></span>
  </div>
</td>
<td>
  <span class="order_item_<%= order_item.feed.code %>">
    <%= t order_item.feed.code %>
  </span>
  <span>
  <% if can_edit %>
    <%= link_to_function '展开或隐藏','',:id => "feeds_on_off_#{order_item.id}", :class => 'off', :title => '进展情况' %>
    <%= loading_image_tag :small, :id => "loading_#{order_item.id}", :class => 'loading hidden' %>
    <script type="text/javascript" charset="utf-8">
      $(document).ready(function() {
        if($('#td_order_item_feed_<%= order_item.id %>').is(':visible')) {
          $('#feeds_on_off_<%= order_item.id %>').addClass('on');
        }
      });
      <%if order.can_be_edited_by_current_user? #是show页面，并且是当前用户编辑%>
      $('#tr_<%= order_item.id %>').mouseover(function() {
        $('#order_item_tool_<%= order_item.id %>').show();
      });
      $('#tr_<%= order_item.id %>').mouseout(function() {
        $('#order_item_tool_<%= order_item.id %>').hide();
      });
      <%end%>
      $('#feeds_on_off_<%= order_item.id %>').click(function() {
        if($('#td_order_item_feed_<%= order_item.id %>').html() == "")
        {
          $.ajax({
            url: "<%= order_item_feeds_order_url(order_item) %>",
            data: { can_edit: <%= can_edit%>},
            beforeSend: function() {
              $('#feeds_on_off_<%= order_item.id %>').hide();
              $('#loading_<%= order_item.id %>').show();
            },
            complete: function() {
              $('#feeds_on_off_<%= order_item.id %>').show();
              $('#loading_<%= order_item.id %>').hide();
            }
          });
        }else{
          $('#feeds_on_off_<%= order_item.id %>').toggleClass('on');
          $('#item_feeds_<%= order_item.id %>').toggle('fast');
        }
      });
    </script>
    <% if Task.where(:order_item_id => order_item).today.waiting.mine.any? %>
    <%= link_to_function "今天有【#{Task.where(:order_item_id => order_item).today.waiting.mine.size}】项任务",
          "$('#feeds_on_off_#{order_item.id}').click()",
          :id => "feeds_task_remind_#{order_item.id}",
          :class => 'light_off',
          :title => "今天有【#{Task.where(:order_item_id => order_item).today.waiting.mine.size}】项任务" %>
    <script type="text/javascript" charset="utf-8">
      $('#feeds_task_remind_<%= order_item.id %>').everyTime(1000,function() {
        $(this).toggleClass("light_on");
      }, 1000);
    </script>
    <% elsif Task.where(:order_item_id => order_item).overdue.waiting.mine.any? %>
    <%= link_to_function "有【#{Task.where(:order_item_id => order_item).overdue.waiting.mine.size}】项任务逾期",
          "$('#feeds_on_off_#{order_item.id}').click()",
          :id => "feeds_task_remind_#{order_item.id}",
          :class => 'overdue',
          :title => "有【#{Task.where(:order_item_id => order_item).overdue.waiting.mine.size}】项任务逾期" %>
    <script type="text/javascript" charset="utf-8">
      $('#feeds_task_remind_<%= order_item.id %>').everyTime(1000,function() {
        $(this).toggleClass("overdue_h");
      }, 1000);
    </script>
    <% end %>
  <% else %>
    <% if Task.where(:order_item_id => order_item).today.waiting.mine.any? %>
      <%= link_to "今天有【#{Task.where(:order_item_id => order_item).today.waiting.mine.size}】项任务",
            order_url(order_item.order),
            :id => "feeds_task_remind_#{order_item.id}",
            :class => 'light_off',
            :target => :_blank,
            :title => "今天有【#{Task.where(:order_item_id => order_item).today.waiting.mine.size}】项任务" %>
      <script type="text/javascript" charset="utf-8">
        $('#feeds_task_remind_<%= order_item.id %>').everyTime(1000,function() {
          $(this).toggleClass("light_on");
        }, 1000);
      </script>
    <% elsif Task.where(:order_item_id => order_item).overdue.waiting.mine.any? %>
      <%= link_to "有【#{Task.where(:order_item_id => order_item).overdue.waiting.mine.size}】项任务逾期",
            order_url(order_item.order),
            :id => "feeds_task_remind_#{order_item.id}",
            :target => :_blank,
            :class => 'overdue',
            :title => "有【#{Task.where(:order_item_id => order_item).overdue.waiting.mine.size}】项任务逾期" %>
      <script type="text/javascript" charset="utf-8">
        $('#feeds_task_remind_<%= order_item.id %>').everyTime(1000,function() {
          $(this).toggleClass("overdue_h");
        }, 1000);
      </script>
    <% end %>
  <% end %>
  </span>
</td>
<td class='r'>
  <div id='order_item_tool_<%= order_item.id %>' class='tools'>
    <div>
      <%if can_edit && order.can_be_edited_by_current_user? #是show页面，并且是当前用户编辑%>
      <%= link_to '编辑',
            edit_order_item_order_url(order_item),
            :remote => true,
            :method => :get,
            :title => '编辑该预订项',
            :class => 'l_crud l_edit no_loading' %>
      <%= link_to "删除",
            order_url(order_item),
            :confirm => "确认要删除【#{order_item.furniture_code}-#{order_item.furniture_name}】吗？",
            :method => :delete,
            :title => '删除该预订项',
            :remote=> true,
            :class => 'l_crud l_delete no_loading',
            :id => "del#{order_item.id}"
       %>
      <%end%>
    </div>
  </div>
</td>